#include <bits/stdc++.h>

using namespace std;

int main_132()
{
    int n,m,u,v;
    scanf("%d%d",&n,&m);
    int adjM[n][n];
    memset(adjM,0,sizeof(adjM));
    for (size_t i=0;i<m ;++i )
    {
        scanf("%d%d",&u,&v);
        adjM[u][v]=adjM[v][u]=1;
    }
    for (size_t i=0;i<n ;++i )
    {
        for (size_t j=0;j<(n-1) ;++j )
        {
            printf("%d ",adjM[i][j]);
        }
        printf("%d\n",adjM[i][n-1]);
    }
    return 0;
}
